package com.masu.knows.faq.security;

import com.masu.knows.faq.interceptor.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//使用SpringMvc框架功能配置跨域
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns(
                        "/v2/questions",        //学生发布问题
                        "/v2/questions/my",     //学生首页问题列表
                        "/v2/questions/teacher" //讲师首页问题列表
                );
            }



}
